package cn.csdj.sism.web;

import cn.csdj.sism.pojo.User;
import cn.csdj.sism.pojo.UserRole;
import cn.csdj.sism.service.UserRoleService;
import cn.csdj.sism.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * UserRole控制层
 * @author 赖可屹
 * 2023/4/11
 */
@CrossOrigin
@RestController
@RequestMapping("/userRole")
public class UserRoleController {
    @Autowired
    private UserRoleService userRoleService;
    @PostMapping
    public void insert(@RequestBody UserRole userRole){
        userRoleService.insert(userRole);
    }
    @DeleteMapping("/{id}")
    public void deleteById(@PathVariable Integer id){
        userRoleService.deleteById(id);
    }
    @PutMapping
    public void update(@RequestBody UserRole userRole){
        userRoleService.update(userRole);
    }
    @GetMapping("/{id}")
    public UserRole selectById(@PathVariable Integer id){
        return userRoleService.selectById(id);
    }
    @GetMapping
    public List<UserRole> selectAll(){
        return userRoleService.selectAll();
    }
}
